## Copyright (c) 2018-2020 Advanced Micro Devices, Inc. All rights reserved.
cmake_minimum_required(VERSION 3.5.1)

set(DEPTH "../../")

set(GPA_PROJECT_NAME PublicCounterDefinitionFiles)
set(ProjectName ${GPA_PROJECT_NAME})

include (${GPA_CMAKE_MODULES_DIR}/common.cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(PUBLIC_COUNTER_DEFINITIONS  public_counter_definitions_gfx8.txt
                                public_counter_definitions_gfx9.txt
                                public_counter_definitions_gfx10.txt)

set(PUBLIC_COUNTER_DEFINITIONS_COMPUTE  public_counter_definitions_compute_gfx8.txt
                                        public_counter_definitions_compute_gfx9.txt
                                        public_counter_definitions_compute_gfx10.txt)

set(SOURCES ${PUBLIC_COUNTER_DEFINITIONS}
            ${PUBLIC_COUNTER_DEFINITIONS_COMPUTE})

add_executable(${GPA_PROJECT_NAME} ${SOURCES})
target_link_libraries(${GPA_PROJECT_NAME}
                      GPUPerfAPI-Common)

set_target_properties(${GPA_PROJECT_NAME} PROPERTIES FOLDER PublicCounterDefinitionFiles)
REMOVE_TARGET_FROM_BUILD(${GPA_PROJECT_NAME})

set(GPA_PROJECT_NAME PublicCounterNames)
set(ProjectName ${GPA_PROJECT_NAME})

include (${GPA_CMAKE_MODULES_DIR}/Common.cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

if(EXISTS ${GPA_AUTOGEN_PUBLIC_COUNTER_INPUT_FILES})
    foreach(API GL DX11 DX12 VK CL)
        string(TOLOWER ${API} API_LOWER_STR)
        include(${GPA_AUTOGEN_PUBLIC_COUNTER_INPUT_FILES}/public_counter_names_${API_LOWER_STR}.cmake)
        set(SOURCES ${SOURCES}
                    ${PUBLIC_COUNTER_NAMES_${API}})
        if(WIN32)
            source_group("AutoGenerated\\${API}" FILES ${PUBLIC_COUNTER_NAMES_${API_LOWER_STR}})
        endif()
    endforeach()
endif()

add_executable(${GPA_PROJECT_NAME} ${SOURCES})
target_link_libraries(${GPA_PROJECT_NAME}
                      GPUPerfAPI-Common)

set_target_properties(${GPA_PROJECT_NAME} PROPERTIES FOLDER PublicCounterNames)
REMOVE_TARGET_FROM_BUILD(${GPA_PROJECT_NAME})

